package com.woniuxy.cq.phrase3.dao;

import com.woniuxy.cq.phrase3.entity.Message;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Lucas
 * @since 2020-09-09
 */
public interface MessageMapper extends BaseMapper<Message> {

    @Select("select * from tb_message where message_user_id = #{userId} and message_status != 'clear'")
    List<Message> getMessage( Integer userId);

    @Select("update tb_message set message_status = #{messageStatus} where message_user_id = #{userId}")
    void updateByuserId(Integer userId,String messageStatus);
    @Insert("insert into tb_message (message_content,message_user_id) values(#{message},#{userId})")
    void insertNewMessage(Integer userId,String message);
}
